package com.hnevc.mytrafficdemo.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.hnevc.mytrafficdemo.R;
import com.hnevc.mytrafficdemo.entity.Car;

import java.util.List;

/**
 * Created by Administrator on 2017/12/24.
 */

public class AntiCarListAdapter extends BaseAdapter {
    Context mContext;
    List<Car> mCarList;

    public AntiCarListAdapter(Context context, List<Car> carList) {
        mContext = context;
        mCarList = carList;
    }

    @Override
    public int getCount() {
        return mCarList.size();
    }

    @Override
    public Object getItem(int i) {
        return mCarList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        view = LayoutInflater.from(mContext).inflate(R.layout.car_list_item_layout,null);
        TextView mTvCarNum = (TextView) view.findViewById(R.id.id_tv_carnumber);
        mTvCarNum.setText(mCarList.get(i).getCardNum());
        return view;
    }
}
